package com.sk.waste.app.bases

import android.view.inputmethod.InputMethodManager
import androidx.appcompat.app.AppCompatActivity
import com.lc.smc.lib.annotations.LCAnnotationView
import com.lc.smc.lib.fragments.LCFragment
import com.sk.waste.app.utils.LcProgressUtil

/**
 * @time 2024/10/15  10:06
 * @author Im_jingwei
 * @desc
 */
abstract class BaseFragment : LCFragment() {
    val TAG = "LCLOG_FRAGMENT"

    var progressDialog: LcProgressUtil? = null


    open fun showProgress() {
        if (progressDialog == null) {
            progressDialog = LcProgressUtil(activity)
        }
        progressDialog!!.show()
    }

    open fun cancleProgress() {
        if (progressDialog != null && progressDialog!!.isShow) {
            progressDialog!!.cancel()
        }
    }

    fun hideKeyboard() {
        val imm = activity?.getSystemService(AppCompatActivity.INPUT_METHOD_SERVICE) as InputMethodManager
        // 第一个参数是当前窗口的 token
        imm.hideSoftInputFromWindow(activity?.window?.decorView?.windowToken, 0)
    }

    /*******************************************  以上框架封装  */
    /*******************************************  以下拓展方法  */
}